package com.oa.dao.impl;

import com.oa.bean.Dept;
import com.oa.dao.DeptDao;
import com.oa.dao.base.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class DeptDaoImpl extends BaseDaoImpl<Dept> implements DeptDao {

    @Override
    public Dept checkDept(String name) {

        String hql = "FROM Dept where name = ?";
        List<Dept> dept = (List<Dept>) this.getHibernateTemplate().find(hql, name);

        if (dept != null && dept.size() > 0) {
            return dept.get(0);
        }

        return null;
    }
}
